﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

//请先添加引用
namespace Chenxin.Lib.Business.DAL
{
	/// <summary>
	/// 数据访问类t_Preliminary_BaseInfo。
	/// </summary>
	public class t_Preliminary_BaseInfo
	{
		public t_Preliminary_BaseInfo()
		{}
		#region  成员方法
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public static void Add(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into t_Preliminary_BaseInfo(");
            strSql.Append("RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate)");
			strSql.Append(" values (");
            strSql.Append("@RecordId,@HouseId,@HouseCode,@Address,@BuildingArea,@BuildingType,@SalePrice_T,@SalePrice_U,@CompleteYear,@Total_Floor,@AppCityId,@AppCityName,@AppCompanyId,@AppCompanyName,@AppDepartId,@AppDepartName,@AppEmployeeId,@AppEmployeeName,@AppEmployeeCode,@PreliminaryCityId,@PreliminaryCityName,@PreliminaryCompanyId,@PreliminaryCompanyName,@PreliminaryDepartId,@PreliminaryDepartName,@LoanTotalMoney,@LoanInfo,@OperateQuanZ,@EmpCityId,@EmpCityName,@EmpCompanyId,@EmpCompanyName,@EmpDepartId,@EmpDepartName,@EmployeeId,@EmployeeName,@EmployeeCode,@EmpPhone,@Receipt,@Mortgage,@SaleName,@SaleIDCard,@SaleSpouseeName,@SaleSpouseeIDCard,@OldLoanBank,@OldLoanMoney,@OldRestMoney,@IsOneYear,@Remark,@PreliminaryApplyDate,@EstimatePrice,@ProposeBank,@GJJmoney,@GJJyear,@SYMoney,@SYYear,@ReplyAdivce,@ReplyCompanyId,@ReplyCompanyName,@ReplyDepartId,@ReplyDepartName,@ReplyUserId,@ReplyUserName,@ReplyPreliminaryDate,@LoanApplyDate,@OrderPlace,@OrderBank,@OrderBeiZhu,@LoanReplyDate,@PreliminaryStatus,@LastDate,@delName,@delUserId,@delTime,@ContractId,@ContractCode,@ContractDate,@OperateCompanyId,@OperateCompanyName,@OperateDepartId,@OperateDepartName,@OperateUserId,@OperateUserName,@SpecialExp,@PreliminaryDate,@LoanDate)");
			Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
			db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
			db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
			db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
			db.AddInParameter(dbCommand, "BuildingArea", DbType.Decimal, model.BuildingArea);
			db.AddInParameter(dbCommand, "BuildingType", DbType.AnsiString, model.BuildingType);
			db.AddInParameter(dbCommand, "SalePrice_T", DbType.Decimal, model.SalePrice_T);
			db.AddInParameter(dbCommand, "SalePrice_U", DbType.Decimal, model.SalePrice_U);
			db.AddInParameter(dbCommand, "CompleteYear", DbType.Int32, model.CompleteYear);
			db.AddInParameter(dbCommand, "Total_Floor", DbType.Int32, model.Total_Floor);
			db.AddInParameter(dbCommand, "AppCityId", DbType.Guid, model.AppCityId);
			db.AddInParameter(dbCommand, "AppCityName", DbType.AnsiString, model.AppCityName);
			db.AddInParameter(dbCommand, "AppCompanyId", DbType.Guid, model.AppCompanyId);
			db.AddInParameter(dbCommand, "AppCompanyName", DbType.AnsiString, model.AppCompanyName);
			db.AddInParameter(dbCommand, "AppDepartId", DbType.Guid, model.AppDepartId);
			db.AddInParameter(dbCommand, "AppDepartName", DbType.AnsiString, model.AppDepartName);
			db.AddInParameter(dbCommand, "AppEmployeeId", DbType.Guid, model.AppEmployeeId);
			db.AddInParameter(dbCommand, "AppEmployeeName", DbType.AnsiString, model.AppEmployeeName);
			db.AddInParameter(dbCommand, "AppEmployeeCode", DbType.AnsiString, model.AppEmployeeCode);
            db.AddInParameter(dbCommand, "PreliminaryCityId", DbType.Guid, model.PreliminaryCityId);
            db.AddInParameter(dbCommand, "PreliminaryCityName", DbType.AnsiString, model.PreliminaryCityName);
			db.AddInParameter(dbCommand, "PreliminaryCompanyId", DbType.Guid, model.PreliminaryCompanyId);
			db.AddInParameter(dbCommand, "PreliminaryCompanyName", DbType.AnsiString, model.PreliminaryCompanyName);
			db.AddInParameter(dbCommand, "PreliminaryDepartId", DbType.Guid, model.PreliminaryDepartId);
			db.AddInParameter(dbCommand, "PreliminaryDepartName", DbType.AnsiString, model.PreliminaryDepartName);
			db.AddInParameter(dbCommand, "LoanTotalMoney", DbType.Decimal, model.LoanTotalMoney);
			db.AddInParameter(dbCommand, "LoanInfo", DbType.AnsiString, model.LoanInfo);
			db.AddInParameter(dbCommand, "OperateQuanZ", DbType.Boolean, model.OperateQuanZ);
            db.AddInParameter(dbCommand, "EmpCityId", DbType.Guid, model.EmpCityId);
            db.AddInParameter(dbCommand, "EmpCityName", DbType.AnsiString, model.EmpCityName);
			db.AddInParameter(dbCommand, "EmpCompanyId", DbType.Guid, model.EmpCompanyId);
			db.AddInParameter(dbCommand, "EmpCompanyName", DbType.AnsiString, model.EmpCompanyName);
			db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
			db.AddInParameter(dbCommand, "EmpDepartName", DbType.AnsiString, model.EmpDepartName);
			db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
			db.AddInParameter(dbCommand, "EmployeeName", DbType.AnsiString, model.EmployeeName);
            db.AddInParameter(dbCommand, "EmployeeCode", DbType.AnsiString, model.EmployeeCode);
			db.AddInParameter(dbCommand, "EmpPhone", DbType.AnsiString, model.EmpPhone);
            db.AddInParameter(dbCommand, "Receipt", DbType.Boolean, model.Receipt);
            db.AddInParameter(dbCommand, "Mortgage", DbType.Boolean, model.Mortgage);
            db.AddInParameter(dbCommand, "SaleName", DbType.AnsiString, model.SaleName);
            db.AddInParameter(dbCommand, "SaleIDCard", DbType.AnsiString, model.SaleIDCard);
            db.AddInParameter(dbCommand, "SaleSpouseeName", DbType.AnsiString, model.SaleSpouseeName);
            db.AddInParameter(dbCommand, "SaleSpouseeIDCard", DbType.AnsiString, model.SaleSpouseeIDCard);
            db.AddInParameter(dbCommand, "OldLoanBank", DbType.AnsiString, model.OldLoanBank);
            db.AddInParameter(dbCommand, "OldLoanMoney", DbType.Decimal, model.OldLoanMoney);
            db.AddInParameter(dbCommand, "OldRestMoney", DbType.Decimal, model.OldRestMoney);
            db.AddInParameter(dbCommand, "IsOneYear", DbType.Boolean, model.IsOneYear);
            db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
			db.AddInParameter(dbCommand, "PreliminaryApplyDate", DbType.DateTime, model.PreliminaryApplyDate);
			db.AddInParameter(dbCommand, "EstimatePrice", DbType.Decimal, model.EstimatePrice);
			db.AddInParameter(dbCommand, "ProposeBank", DbType.AnsiString, model.ProposeBank);
			db.AddInParameter(dbCommand, "GJJmoney", DbType.Decimal, model.GJJmoney);
			db.AddInParameter(dbCommand, "GJJyear", DbType.AnsiString, model.GJJyear);
			db.AddInParameter(dbCommand, "SYMoney", DbType.Decimal, model.SYMoney);
			db.AddInParameter(dbCommand, "SYYear", DbType.AnsiString, model.SYYear);
			db.AddInParameter(dbCommand, "ReplyAdivce", DbType.AnsiString, model.ReplyAdivce);
			db.AddInParameter(dbCommand, "ReplyCompanyId", DbType.Guid, model.ReplyCompanyId);
			db.AddInParameter(dbCommand, "ReplyCompanyName", DbType.AnsiString, model.ReplyCompanyName);
			db.AddInParameter(dbCommand, "ReplyDepartId", DbType.Guid, model.ReplyDepartId);
			db.AddInParameter(dbCommand, "ReplyDepartName", DbType.AnsiString, model.ReplyDepartName);
			db.AddInParameter(dbCommand, "ReplyUserId", DbType.Guid, model.ReplyUserId);
			db.AddInParameter(dbCommand, "ReplyUserName", DbType.AnsiString, model.ReplyUserName);
			db.AddInParameter(dbCommand, "ReplyPreliminaryDate", DbType.DateTime, model.ReplyPreliminaryDate);
			db.AddInParameter(dbCommand, "LoanApplyDate", DbType.DateTime, model.LoanApplyDate);
            db.AddInParameter(dbCommand, "OrderPlace", DbType.AnsiString, model.OrderPlace);
			db.AddInParameter(dbCommand, "OrderBank", DbType.AnsiString, model.OrderBank);
			db.AddInParameter(dbCommand, "OrderBeiZhu", DbType.AnsiString, model.OrderBeiZhu);
			db.AddInParameter(dbCommand, "LoanReplyDate", DbType.DateTime, model.LoanReplyDate);
			db.AddInParameter(dbCommand, "PreliminaryStatus", DbType.Int32, model.PreliminaryStatus);
			db.AddInParameter(dbCommand, "LastDate", DbType.DateTime, model.LastDate);
			db.AddInParameter(dbCommand, "delName", DbType.AnsiString, model.delName);
			db.AddInParameter(dbCommand, "delUserId", DbType.Guid, model.delUserId);
			db.AddInParameter(dbCommand, "delTime", DbType.DateTime, model.delTime);
			db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
			db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
			db.AddInParameter(dbCommand, "ContractDate", DbType.DateTime, model.ContractDate);
			db.AddInParameter(dbCommand, "OperateCompanyId", DbType.Guid, model.OperateCompanyId);
			db.AddInParameter(dbCommand, "OperateCompanyName", DbType.AnsiString, model.OperateCompanyName);
			db.AddInParameter(dbCommand, "OperateDepartId", DbType.Guid, model.OperateDepartId);
			db.AddInParameter(dbCommand, "OperateDepartName", DbType.AnsiString, model.OperateDepartName);
			db.AddInParameter(dbCommand, "OperateUserId", DbType.Guid, model.OperateUserId);
			db.AddInParameter(dbCommand, "OperateUserName", DbType.AnsiString, model.OperateUserName);
            db.AddInParameter(dbCommand, "SpecialExp", DbType.AnsiString, model.SpecialExp);
            db.AddInParameter(dbCommand, "PreliminaryDate", DbType.DateTime, model.PreliminaryDate);
            db.AddInParameter(dbCommand, "LoanDate", DbType.DateTime, model.LoanDate);
			db.ExecuteNonQuery(dbCommand);
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public static void Update(Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update t_Preliminary_BaseInfo set ");
			strSql.Append("HouseId=@HouseId,");
			strSql.Append("HouseCode=@HouseCode,");
			strSql.Append("Address=@Address,");
			strSql.Append("BuildingArea=@BuildingArea,");
			strSql.Append("BuildingType=@BuildingType,");
			strSql.Append("SalePrice_T=@SalePrice_T,");
			strSql.Append("SalePrice_U=@SalePrice_U,");
			strSql.Append("CompleteYear=@CompleteYear,");
			strSql.Append("Total_Floor=@Total_Floor,");
			strSql.Append("AppCityId=@AppCityId,");
			strSql.Append("AppCityName=@AppCityName,");
			strSql.Append("AppCompanyId=@AppCompanyId,");
			strSql.Append("AppCompanyName=@AppCompanyName,");
			strSql.Append("AppDepartId=@AppDepartId,");
			strSql.Append("AppDepartName=@AppDepartName,");
			strSql.Append("AppEmployeeId=@AppEmployeeId,");
			strSql.Append("AppEmployeeName=@AppEmployeeName,");
			strSql.Append("AppEmployeeCode=@AppEmployeeCode,");
            strSql.Append("PreliminaryCityId=@PreliminaryCityId,");
            strSql.Append("PreliminaryCityName=@PreliminaryCityName,");
			strSql.Append("PreliminaryCompanyId=@PreliminaryCompanyId,");
			strSql.Append("PreliminaryCompanyName=@PreliminaryCompanyName,");
			strSql.Append("PreliminaryDepartId=@PreliminaryDepartId,");
			strSql.Append("PreliminaryDepartName=@PreliminaryDepartName,");
			strSql.Append("LoanTotalMoney=@LoanTotalMoney,");
			strSql.Append("LoanInfo=@LoanInfo,");
			strSql.Append("OperateQuanZ=@OperateQuanZ,");
            strSql.Append("EmpCityId=@EmpCityId,");
            strSql.Append("EmpCityName=@EmpCityName,");
			strSql.Append("EmpCompanyId=@EmpCompanyId,");
			strSql.Append("EmpCompanyName=@EmpCompanyName,");
			strSql.Append("EmpDepartId=@EmpDepartId,");
			strSql.Append("EmpDepartName=@EmpDepartName,");
			strSql.Append("EmployeeId=@EmployeeId,");
			strSql.Append("EmployeeName=@EmployeeName,");
            strSql.Append("EmployeeCode=@EmployeeCode,");
			strSql.Append("EmpPhone=@EmpPhone,");
            strSql.Append("Receipt=@Receipt,");
            strSql.Append("Mortgage=@Mortgage,");
            strSql.Append("SaleName=@SaleName,");
            strSql.Append("SaleIDCard=@SaleIDCard,");
            strSql.Append("SaleSpouseeName=@SaleSpouseeName,");
            strSql.Append("SaleSpouseeIDCard=@SaleSpouseeIDCard,");
            strSql.Append("OldLoanBank=@OldLoanBank,");
            strSql.Append("OldLoanMoney=@OldLoanMoney,");
            strSql.Append("OldRestMoney=@OldRestMoney,");
            strSql.Append("IsOneYear=@IsOneYear,");
            strSql.Append("Remark=@Remark,");
			strSql.Append("PreliminaryApplyDate=@PreliminaryApplyDate,");
			strSql.Append("EstimatePrice=@EstimatePrice,");
			strSql.Append("ProposeBank=@ProposeBank,");
			strSql.Append("GJJmoney=@GJJmoney,");
			strSql.Append("GJJyear=@GJJyear,");
			strSql.Append("SYMoney=@SYMoney,");
			strSql.Append("SYYear=@SYYear,");
			strSql.Append("ReplyAdivce=@ReplyAdivce,");
			strSql.Append("ReplyCompanyId=@ReplyCompanyId,");
			strSql.Append("ReplyCompanyName=@ReplyCompanyName,");
			strSql.Append("ReplyDepartId=@ReplyDepartId,");
			strSql.Append("ReplyDepartName=@ReplyDepartName,");
			strSql.Append("ReplyUserId=@ReplyUserId,");
			strSql.Append("ReplyUserName=@ReplyUserName,");
			strSql.Append("ReplyPreliminaryDate=@ReplyPreliminaryDate,");
			strSql.Append("LoanApplyDate=@LoanApplyDate,");
			strSql.Append("OrderPlace=@OrderPlace,");
			strSql.Append("OrderBank=@OrderBank,");
			strSql.Append("OrderBeiZhu=@OrderBeiZhu,");
			strSql.Append("LoanReplyDate=@LoanReplyDate,");
			strSql.Append("PreliminaryStatus=@PreliminaryStatus,");
			strSql.Append("LastDate=@LastDate,");
			strSql.Append("delName=@delName,");
			strSql.Append("delUserId=@delUserId,");
			strSql.Append("delTime=@delTime,");
			strSql.Append("ContractId=@ContractId,");
			strSql.Append("ContractCode=@ContractCode,");
			strSql.Append("ContractDate=@ContractDate,");
			strSql.Append("OperateCompanyId=@OperateCompanyId,");
			strSql.Append("OperateCompanyName=@OperateCompanyName,");
			strSql.Append("OperateDepartId=@OperateDepartId,");
			strSql.Append("OperateDepartName=@OperateDepartName,");
			strSql.Append("OperateUserId=@OperateUserId,");
            strSql.Append("OperateUserName=@OperateUserName,");
            strSql.Append("SpecialExp=@SpecialExp,");
            strSql.Append("PreliminaryDate=@PreliminaryDate,");
            strSql.Append("LoanDate=@LoanDate");
			strSql.Append(" where RecordId=@RecordId ");
			Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
			db.AddInParameter(dbCommand, "HouseId", DbType.Guid, model.HouseId);
			db.AddInParameter(dbCommand, "HouseCode", DbType.AnsiString, model.HouseCode);
			db.AddInParameter(dbCommand, "Address", DbType.AnsiString, model.Address);
			db.AddInParameter(dbCommand, "BuildingArea", DbType.Decimal, model.BuildingArea);
			db.AddInParameter(dbCommand, "BuildingType", DbType.AnsiString, model.BuildingType);
			db.AddInParameter(dbCommand, "SalePrice_T", DbType.Decimal, model.SalePrice_T);
			db.AddInParameter(dbCommand, "SalePrice_U", DbType.Decimal, model.SalePrice_U);
			db.AddInParameter(dbCommand, "CompleteYear", DbType.Int32, model.CompleteYear);
			db.AddInParameter(dbCommand, "Total_Floor", DbType.Int32, model.Total_Floor);
			db.AddInParameter(dbCommand, "AppCityId", DbType.Guid, model.AppCityId);
			db.AddInParameter(dbCommand, "AppCityName", DbType.AnsiString, model.AppCityName);
			db.AddInParameter(dbCommand, "AppCompanyId", DbType.Guid, model.AppCompanyId);
			db.AddInParameter(dbCommand, "AppCompanyName", DbType.AnsiString, model.AppCompanyName);
			db.AddInParameter(dbCommand, "AppDepartId", DbType.Guid, model.AppDepartId);
			db.AddInParameter(dbCommand, "AppDepartName", DbType.AnsiString, model.AppDepartName);
			db.AddInParameter(dbCommand, "AppEmployeeId", DbType.Guid, model.AppEmployeeId);
			db.AddInParameter(dbCommand, "AppEmployeeName", DbType.AnsiString, model.AppEmployeeName);
			db.AddInParameter(dbCommand, "AppEmployeeCode", DbType.AnsiString, model.AppEmployeeCode);
            db.AddInParameter(dbCommand, "PreliminaryCityId", DbType.Guid, model.PreliminaryCityId);
            db.AddInParameter(dbCommand, "PreliminaryCityName", DbType.AnsiString, model.PreliminaryCityName);
			db.AddInParameter(dbCommand, "PreliminaryCompanyId", DbType.Guid, model.PreliminaryCompanyId);
			db.AddInParameter(dbCommand, "PreliminaryCompanyName", DbType.AnsiString, model.PreliminaryCompanyName);
			db.AddInParameter(dbCommand, "PreliminaryDepartId", DbType.Guid, model.PreliminaryDepartId);
			db.AddInParameter(dbCommand, "PreliminaryDepartName", DbType.AnsiString, model.PreliminaryDepartName);
			db.AddInParameter(dbCommand, "LoanTotalMoney", DbType.Decimal, model.LoanTotalMoney);
			db.AddInParameter(dbCommand, "LoanInfo", DbType.AnsiString, model.LoanInfo);
			db.AddInParameter(dbCommand, "OperateQuanZ", DbType.Boolean, model.OperateQuanZ);
            db.AddInParameter(dbCommand, "EmpCityId", DbType.Guid, model.EmpCityId);
            db.AddInParameter(dbCommand, "EmpCityName", DbType.AnsiString, model.EmpCityName);
			db.AddInParameter(dbCommand, "EmpCompanyId", DbType.Guid, model.EmpCompanyId);
			db.AddInParameter(dbCommand, "EmpCompanyName", DbType.AnsiString, model.EmpCompanyName);
			db.AddInParameter(dbCommand, "EmpDepartId", DbType.Guid, model.EmpDepartId);
			db.AddInParameter(dbCommand, "EmpDepartName", DbType.AnsiString, model.EmpDepartName);
			db.AddInParameter(dbCommand, "EmployeeId", DbType.Guid, model.EmployeeId);
			db.AddInParameter(dbCommand, "EmployeeName", DbType.AnsiString, model.EmployeeName);
            db.AddInParameter(dbCommand, "EmployeeCode", DbType.AnsiString, model.EmployeeCode);
			db.AddInParameter(dbCommand, "EmpPhone", DbType.AnsiString, model.EmpPhone);
            db.AddInParameter(dbCommand, "Receipt", DbType.Boolean, model.Receipt);
            db.AddInParameter(dbCommand, "Mortgage", DbType.Boolean, model.Mortgage);
            db.AddInParameter(dbCommand, "SaleName", DbType.AnsiString, model.SaleName);
            db.AddInParameter(dbCommand, "SaleIDCard", DbType.AnsiString, model.SaleIDCard);
            db.AddInParameter(dbCommand, "SaleSpouseeName", DbType.AnsiString, model.SaleSpouseeName);
            db.AddInParameter(dbCommand, "SaleSpouseeIDCard", DbType.AnsiString, model.SaleSpouseeIDCard);
            db.AddInParameter(dbCommand, "OldLoanBank", DbType.AnsiString, model.OldLoanBank);
            db.AddInParameter(dbCommand, "OldLoanMoney", DbType.Decimal, model.OldLoanMoney);
            db.AddInParameter(dbCommand, "OldRestMoney", DbType.Decimal, model.OldRestMoney);
            db.AddInParameter(dbCommand, "IsOneYear", DbType.Boolean, model.IsOneYear);
            db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
			db.AddInParameter(dbCommand, "PreliminaryApplyDate", DbType.DateTime, model.PreliminaryApplyDate);
			db.AddInParameter(dbCommand, "EstimatePrice", DbType.Decimal, model.EstimatePrice);
			db.AddInParameter(dbCommand, "ProposeBank", DbType.AnsiString, model.ProposeBank);
			db.AddInParameter(dbCommand, "GJJmoney", DbType.Decimal, model.GJJmoney);
			db.AddInParameter(dbCommand, "GJJyear", DbType.AnsiString, model.GJJyear);
			db.AddInParameter(dbCommand, "SYMoney", DbType.Decimal, model.SYMoney);
			db.AddInParameter(dbCommand, "SYYear", DbType.AnsiString, model.SYYear);
			db.AddInParameter(dbCommand, "ReplyAdivce", DbType.AnsiString, model.ReplyAdivce);
			db.AddInParameter(dbCommand, "ReplyCompanyId", DbType.Guid, model.ReplyCompanyId);
			db.AddInParameter(dbCommand, "ReplyCompanyName", DbType.AnsiString, model.ReplyCompanyName);
			db.AddInParameter(dbCommand, "ReplyDepartId", DbType.Guid, model.ReplyDepartId);
			db.AddInParameter(dbCommand, "ReplyDepartName", DbType.AnsiString, model.ReplyDepartName);
			db.AddInParameter(dbCommand, "ReplyUserId", DbType.Guid, model.ReplyUserId);
			db.AddInParameter(dbCommand, "ReplyUserName", DbType.AnsiString, model.ReplyUserName);
			db.AddInParameter(dbCommand, "ReplyPreliminaryDate", DbType.DateTime, model.ReplyPreliminaryDate);
			db.AddInParameter(dbCommand, "LoanApplyDate", DbType.DateTime, model.LoanApplyDate);
            db.AddInParameter(dbCommand, "OrderPlace", DbType.AnsiString, model.OrderPlace);
			db.AddInParameter(dbCommand, "OrderBank", DbType.AnsiString, model.OrderBank);
			db.AddInParameter(dbCommand, "OrderBeiZhu", DbType.AnsiString, model.OrderBeiZhu);
			db.AddInParameter(dbCommand, "LoanReplyDate", DbType.DateTime, model.LoanReplyDate);
			db.AddInParameter(dbCommand, "PreliminaryStatus", DbType.Int32, model.PreliminaryStatus);
			db.AddInParameter(dbCommand, "LastDate", DbType.DateTime, model.LastDate);
			db.AddInParameter(dbCommand, "delName", DbType.AnsiString, model.delName);
			db.AddInParameter(dbCommand, "delUserId", DbType.Guid, model.delUserId);
			db.AddInParameter(dbCommand, "delTime", DbType.DateTime, model.delTime);
			db.AddInParameter(dbCommand, "ContractId", DbType.Guid, model.ContractId);
			db.AddInParameter(dbCommand, "ContractCode", DbType.AnsiString, model.ContractCode);
			db.AddInParameter(dbCommand, "ContractDate", DbType.DateTime, model.ContractDate);
			db.AddInParameter(dbCommand, "OperateCompanyId", DbType.Guid, model.OperateCompanyId);
			db.AddInParameter(dbCommand, "OperateCompanyName", DbType.AnsiString, model.OperateCompanyName);
			db.AddInParameter(dbCommand, "OperateDepartId", DbType.Guid, model.OperateDepartId);
			db.AddInParameter(dbCommand, "OperateDepartName", DbType.AnsiString, model.OperateDepartName);
			db.AddInParameter(dbCommand, "OperateUserId", DbType.Guid, model.OperateUserId);
			db.AddInParameter(dbCommand, "OperateUserName", DbType.AnsiString, model.OperateUserName);
            db.AddInParameter(dbCommand, "SpecialExp", DbType.AnsiString, model.SpecialExp);
            db.AddInParameter(dbCommand, "PreliminaryDate", DbType.DateTime, model.PreliminaryDate);
            db.AddInParameter(dbCommand, "LoanDate", DbType.DateTime, model.LoanDate);
			db.ExecuteNonQuery(dbCommand);

		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public static void Delete(Guid RecordId)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from t_Preliminary_BaseInfo ");
			strSql.Append(" where RecordId=@RecordId ");
			Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "RecordId", DbType.Guid,RecordId);
			db.ExecuteNonQuery(dbCommand);

		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo GetModel(Guid RecordId)
		{
			
			StringBuilder strSql=new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate from t_Preliminary_BaseInfo ");
			strSql.Append(" where RecordId=@RecordId ");
			Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "RecordId", DbType.Guid,RecordId);
            Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;
			using (IDataReader dataReader = db.ExecuteReader(dbCommand))
			{
				if(dataReader.Read())
				{
					model=ReaderBind(dataReader);
				}
				dataReader.Close();
                dataReader.Dispose();
			}
			return model;
		}

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo GetOldModel(Guid HouseId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate from t_Preliminary_BaseInfo ");
            strSql.Append(" where HouseId=@HouseId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, HouseId);
            Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo GetLatestModelByHouseId(string HouseId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT TOP 1 RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate from t_Preliminary_BaseInfo ");
            strSql.Append(" WHERE HouseId=@HouseId ");
            strSql.Append(" ORDER BY LastDate DESC");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "HouseId", DbType.Guid, new Guid(HouseId));
            Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo GetOldModelByAddress(string Address)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate from t_Preliminary_BaseInfo ");
            strSql.Append(" where Address=@Address ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "Address", DbType.String, Address);
            Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 通过PreliminaryId得到一个对象实体
        /// </summary>
        //public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo GetEntityById(Guid RecordId)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append(" select a.RecordId,a.HouseId,a.HouseCode,a.Address,a.BuildingArea,a.BuildingType,a.SalePrice_T,a.CompleteYear,a.Total_Floor,a.LoanTotalMoney,a.LoanInfo,a.EmpDepartName,a.EmployeeName,a.EmpPhone,a.Receipt,a.Mortgage,a.SaleName,a.SaleIDCard,a.SaleSpouseeName,a.SaleSpouseeIDCard,a.OldLoanBank,a.OldLoanMoney,a.OldRestMoney,a.IsOneYear,a.Remark,a.PreliminaryApplyDate,a.EstimatePrice,a.ProposeBank,a.GJJmoney,a.GJJyear,a.SYMoney,a.SYYear,a.ReplyAdivce,a.ReplyUserName,a.ReplyPreliminaryDate,a.LoanApplyDate,a.OrderPlace,a.OrderBank,a.OrderBeiZhu ");
        //    strSql.Append(" from t_Preliminary_BaseInfo a ");
        //    strSql.Append(" where a.RecordId=@RecordId order by a.PreliminaryApplyDate");
        //    Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
        //    DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
        //    db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
        //    Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;
        //    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
        //    {
        //        if (dataReader.Read())
        //        {
        //            model = ReaderBind(dataReader);
        //        }
        //        dataReader.Close();
        //        dataReader.Dispose();
        //    }
        //    return model;
        //}

        /// <summary>
        /// 通过PreliminaryId得到一个对象实体
        /// </summary>
        //public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo GetPreApplyInfo(Guid RecordId)
        //{
        //    StringBuilder strSql = new StringBuilder();
        //    strSql.Append(" select a.RecordId,a.HouseId,a.HouseCode,a.Address,a.BuildingArea,a.BuildingType,a.SalePrice_T,a.CompleteYear,a.Total_Floor,a.LoanTotalMoney,a.LoanInfo,a.EmpDepartName,a.EmployeeName,a.EmpPhone,a.Receipt,a.Mortgage,a.SaleName,a.SaleIDCard,a.SaleSpouseeName,a.SaleSpouseeIDCard,a.OldLoanBank,a.OldLoanMoney,a.OldRestMoney,a.IsOneYear ");
        //    strSql.Append(" from t_Preliminary_BaseInfo a ");
        //    strSql.Append(" where a.RecordId=@RecordId order by a.PreliminaryApplyDate");
        //    Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
        //    DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
        //    db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
        //    Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model = null;
        //    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
        //    {
        //        if (dataReader.Read())
        //        {
        //            model = ReaderBind(dataReader);
        //        }
        //        dataReader.Close();
        //        dataReader.Dispose();
        //    }
        //    return model;
        //}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public static DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate ");
			strSql.Append(" FROM t_Preliminary_BaseInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
			return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
		}

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageIndex, int PageSize, String OrderField, string TableName, string StrWhere, string FieldList, string TableFieldList, bool DoCount)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, OrderField);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, TableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, StrWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, FieldList);
            db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }

		/// <summary>
		/// 获得数据列表（比DataSet效率高，推荐使用）
		/// </summary>
		public static List<Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo> GetListArray(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
            strSql.Append("select RecordId,HouseId,HouseCode,Address,BuildingArea,BuildingType,SalePrice_T,SalePrice_U,CompleteYear,Total_Floor,AppCityId,AppCityName,AppCompanyId,AppCompanyName,AppDepartId,AppDepartName,AppEmployeeId,AppEmployeeName,AppEmployeeCode,PreliminaryCityId,PreliminaryCityName,PreliminaryCompanyId,PreliminaryCompanyName,PreliminaryDepartId,PreliminaryDepartName,LoanTotalMoney,LoanInfo,OperateQuanZ,EmpCityId,EmpCityName,EmpCompanyId,EmpCompanyName,EmpDepartId,EmpDepartName,EmployeeId,EmployeeName,EmployeeCode,EmpPhone,Receipt,Mortgage,SaleName,SaleIDCard,SaleSpouseeName,SaleSpouseeIDCard,OldLoanBank,OldLoanMoney,OldRestMoney,IsOneYear,Remark,PreliminaryApplyDate,EstimatePrice,ProposeBank,GJJmoney,GJJyear,SYMoney,SYYear,ReplyAdivce,ReplyCompanyId,ReplyCompanyName,ReplyDepartId,ReplyDepartName,ReplyUserId,ReplyUserName,ReplyPreliminaryDate,LoanApplyDate,OrderPlace,OrderBank,OrderBeiZhu,LoanReplyDate,PreliminaryStatus,LastDate,delName,delUserId,delTime,ContractId,ContractCode,ContractDate,OperateCompanyId,OperateCompanyName,OperateDepartId,OperateDepartName,OperateUserId,OperateUserName,SpecialExp,PreliminaryDate,LoanDate ");
			strSql.Append(" FROM t_Preliminary_BaseInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			List<Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo> list = new List<Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo>();
			Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
			using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
			{
				while (dataReader.Read())
				{
					list.Add(ReaderBind(dataReader));
				}
				dataReader.Close();
                dataReader.Dispose();
			}
			return list;
		}

		/// <summary>
		/// 对象实体绑定数据
		/// </summary>
		public static Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo ReaderBind(IDataReader dataReader)
		{
			Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo model=new Chenxin.Lib.Business.Entity.t_Preliminary_BaseInfo();
			object ojb; 
			ojb = dataReader["RecordId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.RecordId= new Guid(ojb.ToString());
			}
			ojb = dataReader["HouseId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.HouseId= new Guid(ojb.ToString());
			}
			model.HouseCode=dataReader["HouseCode"].ToString();
			model.Address=dataReader["Address"].ToString();
			ojb = dataReader["BuildingArea"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.BuildingArea=(decimal)ojb;
			}
			model.BuildingType=dataReader["BuildingType"].ToString();
			ojb = dataReader["SalePrice_T"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.SalePrice_T=(decimal)ojb;
			}
			ojb = dataReader["SalePrice_U"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.SalePrice_U=(decimal)ojb;
			}
			ojb = dataReader["CompleteYear"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.CompleteYear=(int)ojb;
			}
			ojb = dataReader["Total_Floor"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.Total_Floor=(int)ojb;
			}
			ojb = dataReader["AppCityId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.AppCityId= new Guid(ojb.ToString());
			}
			model.AppCityName=dataReader["AppCityName"].ToString();
			ojb = dataReader["AppCompanyId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.AppCompanyId= new Guid(ojb.ToString());
			}
			model.AppCompanyName=dataReader["AppCompanyName"].ToString();
			ojb = dataReader["AppDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.AppDepartId= new Guid(ojb.ToString());
			}
			model.AppDepartName=dataReader["AppDepartName"].ToString();
			ojb = dataReader["AppEmployeeId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.AppEmployeeId= new Guid(ojb.ToString());
			}
			model.AppEmployeeName=dataReader["AppEmployeeName"].ToString();
			model.AppEmployeeCode=dataReader["AppEmployeeCode"].ToString();
            ojb = dataReader["PreliminaryCityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PreliminaryCityId = new Guid(ojb.ToString());
            }
            model.PreliminaryCityName = dataReader["PreliminaryCityName"].ToString();
			ojb = dataReader["PreliminaryCompanyId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.PreliminaryCompanyId= new Guid(ojb.ToString());
			}
			model.PreliminaryCompanyName=dataReader["PreliminaryCompanyName"].ToString();
			ojb = dataReader["PreliminaryDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.PreliminaryDepartId= new Guid(ojb.ToString());
			}
			model.PreliminaryDepartName=dataReader["PreliminaryDepartName"].ToString();
			ojb = dataReader["LoanTotalMoney"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.LoanTotalMoney=(decimal)ojb;
			}
			model.LoanInfo=dataReader["LoanInfo"].ToString();
			ojb = dataReader["OperateQuanZ"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.OperateQuanZ=(bool)ojb;
			}
            ojb = dataReader["EmpCityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EmpCityId = new Guid(ojb.ToString());
            }
            model.EmpCityName = dataReader["EmpCityName"].ToString();
			ojb = dataReader["EmpCompanyId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.EmpCompanyId= new Guid(ojb.ToString());
			}
			model.EmpCompanyName=dataReader["EmpCompanyName"].ToString();
			ojb = dataReader["EmpDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.EmpDepartId= new Guid(ojb.ToString());
			}
			model.EmpDepartName=dataReader["EmpDepartName"].ToString();
			ojb = dataReader["EmployeeId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.EmployeeId= new Guid(ojb.ToString());
			}
			model.EmployeeName=dataReader["EmployeeName"].ToString();
            model.EmployeeCode = dataReader["EmployeeCode"].ToString();
			model.EmpPhone=dataReader["EmpPhone"].ToString();
            ojb = dataReader["Receipt"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Receipt = (bool)ojb;
            }
            ojb = dataReader["Mortgage"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Mortgage = (bool)ojb;
            }
            model.SaleName = dataReader["SaleName"].ToString();
            model.SaleIDCard = dataReader["SaleIDCard"].ToString();
            model.SaleSpouseeName = dataReader["SaleSpouseeName"].ToString();
            model.SaleSpouseeIDCard = dataReader["SaleSpouseeIDCard"].ToString();
            model.OldLoanBank = dataReader["OldLoanBank"].ToString();
            ojb = dataReader["OldLoanMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OldLoanMoney = (decimal)ojb;
            }
            ojb = dataReader["OldRestMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OldRestMoney = (decimal)ojb;
            }
            ojb = dataReader["IsOneYear"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsOneYear = (bool)ojb;
            }
            model.Remark = dataReader["Remark"].ToString();
			ojb = dataReader["PreliminaryApplyDate"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.PreliminaryApplyDate=(DateTime)ojb;
			}
			ojb = dataReader["EstimatePrice"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.EstimatePrice=(decimal)ojb;
			}
			model.ProposeBank=dataReader["ProposeBank"].ToString();
			ojb = dataReader["GJJmoney"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.GJJmoney=(decimal)ojb;
			}
			model.GJJyear=dataReader["GJJyear"].ToString();
			ojb = dataReader["SYMoney"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.SYMoney=(decimal)ojb;
			}
			model.SYYear=dataReader["SYYear"].ToString();
			model.ReplyAdivce=dataReader["ReplyAdivce"].ToString();
			ojb = dataReader["ReplyCompanyId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ReplyCompanyId= new Guid(ojb.ToString());
			}
			model.ReplyCompanyName=dataReader["ReplyCompanyName"].ToString();
			ojb = dataReader["ReplyDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ReplyDepartId= new Guid(ojb.ToString());
			}
			model.ReplyDepartName=dataReader["ReplyDepartName"].ToString();
			ojb = dataReader["ReplyUserId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ReplyUserId= new Guid(ojb.ToString());
			}
			model.ReplyUserName=dataReader["ReplyUserName"].ToString();
			ojb = dataReader["ReplyPreliminaryDate"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ReplyPreliminaryDate=(DateTime)ojb;
			}
			ojb = dataReader["LoanApplyDate"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.LoanApplyDate=(DateTime)ojb;
			}
            model.OrderPlace = dataReader["OrderPlace"].ToString();
			model.OrderBank=dataReader["OrderBank"].ToString();
			model.OrderBeiZhu=dataReader["OrderBeiZhu"].ToString();
			ojb = dataReader["LoanReplyDate"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.LoanReplyDate=(DateTime)ojb;
			}
			ojb = dataReader["PreliminaryStatus"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.PreliminaryStatus=(int)ojb;
			}
			ojb = dataReader["LastDate"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.LastDate=(DateTime)ojb;
			}
			model.delName=dataReader["delName"].ToString();
			ojb = dataReader["delUserId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.delUserId= new Guid(ojb.ToString());
			}
			ojb = dataReader["delTime"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.delTime=(DateTime)ojb;
			}
			ojb = dataReader["ContractId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ContractId= new Guid(ojb.ToString());
			}
			model.ContractCode=dataReader["ContractCode"].ToString();
			ojb = dataReader["ContractDate"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ContractDate=(DateTime)ojb;
			}
			ojb = dataReader["OperateCompanyId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.OperateCompanyId= new Guid(ojb.ToString());
			}
			model.OperateCompanyName=dataReader["OperateCompanyName"].ToString();
			ojb = dataReader["OperateDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.OperateDepartId= new Guid(ojb.ToString());
			}
			model.OperateDepartName=dataReader["OperateDepartName"].ToString();
			ojb = dataReader["OperateUserId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.OperateUserId= new Guid(ojb.ToString());
			}
			model.OperateUserName=dataReader["OperateUserName"].ToString();
            model.SpecialExp = dataReader["SpecialExp"].ToString();
            ojb = dataReader["PreliminaryDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PreliminaryDate = (DateTime)ojb;
            }
            ojb = dataReader["LoanDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LoanDate = (DateTime)ojb;
            }
			return model;
		}

		#endregion  成员方法
	}
}